package cn.yuanqiao.archive.appManager.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 文号责任者对象 YQWHZRZ
 * 
 * @author sy
 * @date 2023-09-12
 */
public class YqWhzrz extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQWHZRZ";

    public YqWhzrz() {
        String userCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(userCode)){
//            throw new ServiceException("TenantCode is null");
            this.tableName = "YQWHZRZ";
        }else {
            this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQWHZRZ";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** ID */
    @IdAnnotation
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long id;

    /** 全宗名称 */
    @Excel(name = "全宗名称")
    private String fondsName;

    /** 文号责任者 */
    @Excel(name = "文号责任者")
    private String whzrz;

    /** 创建人 */
    @Excel(name = "创建人")
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long creatorId;

    /** 创建人姓名 */
    @Excel(name = "创建人姓名")
    private String creatorName;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
//    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createTime;

    /** 最后修改人 */
    @Excel(name = "最后修改人")
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long lastupdater;

    /** 最后修改时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date lastupdateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFondsName() {
        return fondsName;
    }

    public void setFondsName(String fondsName) {
        this.fondsName = fondsName;
    }

    public String getWhzrz() {
        return whzrz;
    }

    public void setWhzrz(String whzrz) {
        this.whzrz = whzrz;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Long getLastupdater() {
        return lastupdater;
    }

    public void setLastupdater(Long lastupdater) {
        this.lastupdater = lastupdater;
    }

    public Date getLastupdateTime() {
        return lastupdateTime;
    }

    public void setLastupdateTime(Date lastupdateTime) {
        this.lastupdateTime = lastupdateTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("ID", getId())
            .append("fondsName", getFondsName())
            .append("whzrz", getWhzrz())
            .append("creatorId", getCreatorId())
            .append("creatorName", getCreatorName())
            .append("createTime", getCreateTime())
            .append("lastupdater", getLastupdater())
            .append("lastupdateTime", getLastupdateTime())
            .toString();
    }
}
